<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>学习之旅案例</title>
</head>

<body>
  <div id='app'>
    <!-- 不要在属性中使用插值表达式 -->
    <button v-show="index > 0" @click="nextPage()">上一页</button>
    <div>
      <img :src="urlList[index]" alt="">
    </div>
    <button v-show="urlList.length - 1 > index" @click="lastPage()">下一页</button>

  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.7.16/dist/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        // 点击上一页或者下一页，修改图片
        nextBtn: false,
        lastBtn: false,
        index: 0,
        urlList: ['./imgs/11-00.gif', './imgs/11-01.gif',
          './imgs/11-02.gif', './imgs/11-03.gif',
          './imgs/11-04.png', './imgs/11-05.png'
        ]

      },
      methods: {
        nextPage() {
          if (this.index <= 0) {
            alert('已经是第一张了')
            return
          }
          this.index--
        },
        lastPage() {
          if (this.index >= this.urlList.length - 1) {
            alert('已经是最后一张了')
            return
          }
          this.index++
        }

      }
    })
  </script>
</body>

</html>